<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		
		
				//代码示例，此两项代码可以放到App.vue
			this.addJYJPushReceiveNotificationListener();
			this.addJYJPushReceiveOpenNotificationListener();
		
			this.addJYJPushCustomReceiveNotificationListener();
		
			setTimeout(function(){
				const jyJPush = uni.requireNativePlugin('JY-JPushThird');
				if(uni.getSystemInfoSync().platform === 'android'){
					jyJPush.android_init(res=> {
					// uni.showToast({
					// 	icon:'none',
					// 	title: JSON.stringify(result)
					// 	})			
					});
				}
				jyJPush.getLastPushInfo(result => {
					if (result != null) {
						// uni.showToast({
						// 	icon: 'none',
						// 	title: 'last' + JSON.stringify(result)
						// })
					}
					});
						
				
			}, 500);
		},
		onShow: function() {
			// uni.clearStorageSync();
			// console.log('App OnShow')
		},
		onHide: function() {
			// console.log('App Hide')
		},
		methods: {
			addJYJPushReceiveOpenNotificationListener() {
				const jyJPush = uni.requireNativePlugin('JY-JPushThird');
				jyJPush.addJYJPushReceiveOpenNotificationListener(result => {
					// uni.showToast({
					// 	icon: 'none',
					// 	title: 'open' + JSON.stringify(result)
					// })
					console.log('打开了' + JSON.stringify(result));
				});
			},
			addJYJPushReceiveNotificationListener() {
				const jyJPush = uni.requireNativePlugin('JY-JPushThird');
				jyJPush.addJYJPushReceiveNotificationListener(result => {
					// uni.showToast({
					// 	icon: 'none',
					// 	title: 'rec' + JSON.stringify(result)
					// })
					console.log('收到了' + JSON.stringify(result));
				});
			},
			addJYJPushReceiveBackgroudNotificationListener(){
				const jyJPush = uni.requireNativePlugin('JY-JPushThird');
				jyJPush.addJYJPushReceiveBackgroudNotificationListener(result => {
					// uni.showToast({
					// 	icon: 'none',
					// 	title: 'recback' + JSON.stringify(result)
					// })
					console.log('后台收到了' + JSON.stringify(result));
				});
				
			},
			addJYJPushCustomReceiveNotificationListener() {
				const jyJPush = uni.requireNativePlugin('JY-JPushThird');
				jyJPush.addJYJPushCustomReceiveNotificationListener(result => {
					// uni.showToast({
					// 	icon: 'none',
					// 	title: 'ReceiveCustomNotificationListener' + JSON.stringify(result),
					// })
		
					
				});
			}
			
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
